<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>HTML::TreeBuilder - Parser that builds a HTML syntax tree - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of HTML-Tree - MetaCPAN" href="https://metacpan.org/dist/HTML-Tree/releases.rss" />
        <link rel="canonical" href="./HTML::TreeBuilder.html" />
        <meta name="description" content="Parser that builds a HTML syntax tree" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/HTML::TreeBuilder" />
<meta name="twitter:title"       content="HTML::TreeBuilder" />
<meta name="twitter:description" content="Parser that builds a HTML syntax tree" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./HTML::TreeBuilder.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of HTML-Tree was released.">
      <span class="relatize">31 Aug 2017 08:53:16 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/HTML-Tree">HTML-Tree</a>
  </li>
  <li>
    Module version: 5.07
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/HTML-Tree/source/lib/HTML/TreeBuilder.pm">Source</a>
    (<a href="https://metacpan.org/dist/HTML-Tree/source/lib/HTML/TreeBuilder.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/HTML-Tree/source/lib/HTML">Browse</a>
    (<a href="https://metacpan.org/dist/HTML-Tree/source/lib/HTML?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/HTML-Tree/changes">Changes</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/HTML-Tree/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/kentfredric/HTML-Tree">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://rt.cpan.org/Public/Dist/Display.html?Name=HTML-Tree">Issues</a>
      (23)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=HTML-Tree+5.07" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/H/HTML-Tree.html?oncpan=1&amp;distmat=1&amp;version=5.07&amp;grade=2" style="color: #090">1546</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/H/HTML-Tree.html?oncpan=1&amp;distmat=1&amp;version=5.07&amp;grade=3" style="color: #900">0</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/H/HTML-Tree.html?oncpan=1&amp;distmat=1&amp;version=5.07&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/KENTNL/HTML-Tree-5.07">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on HTML-Tree who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 0
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/HTML-Tree-5.07/index.html">61.54% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li>
      Perl: v5.8.0
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/HTML-Tree/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/K/KE/KENTNL/HTML-Tree-5.07.tar.gz">
      Download (<span itemprop="fileSize">146.95KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FKENTNL%2FHTML-Tree-5.07%2Flib%2FHTML%2FTreeBuilder.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/HTML-Tree/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/HTML-Tree/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:HTML-Tree">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="HTML-Tree">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/HTML/TreeBuilder.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="KENTNL/HTML-Tree-5.07"
>5.07
  (KENTNL on 2017-08-31)</option>
<option
  
  value="KENTNL/HTML-Tree-5.06"
>5.06
  (KENTNL on 2017-04-28)</option>
<option
  
  value="KENTNL/HTML-Tree-5.910-TRIAL"
>5.910-TRIAL DEV
  (KENTNL on 2017-04-26)</option>
<option
  
  value="KENTNL/HTML-Tree-5.05"
>5.05
  (KENTNL on 2017-04-26)</option>
<option
  
  value="JFEARN/HTML-Tree-5.04"
>5.04
  (JFEARN on 2017-04-18)</option>
<option
  
  value="CJM/HTML-Tree-5.909-TRIAL"
>5.909-TRIAL DEV
  (CJM on 2014-05-24)</option>
<option
  
  value="CJM/HTML-Tree-5.908-TRIAL"
>5.908-TRIAL DEV
  (CJM on 2014-05-17)</option>
<option
  
  value="CJM/HTML-Tree-5.907-TRIAL"
>5.907-TRIAL DEV
  (CJM on 2013-09-14)</option>
<option
  
  value="CJM/HTML-Tree-5.906-TRIAL"
>5.906-TRIAL DEV
  (CJM on 2013-07-13)</option>
<option
  
  value="CJM/HTML-Tree-5.905-TRIAL"
>5.905-TRIAL DEV
  (CJM on 2013-06-29)</option>
<option
  
  value="CJM/HTML-Tree-5.904-TRIAL"
>5.904-TRIAL DEV
  (CJM on 2013-06-08)</option>
<option
  
  value="CJM/HTML-Tree-5.903-TRIAL"
>5.903-TRIAL DEV
  (CJM on 2013-06-01)</option>
<option
  
  value="CJM/HTML-Tree-5.902-TRIAL"
>5.902-TRIAL DEV
  (CJM on 2013-03-02)</option>
<option
  
  value="CJM/HTML-Tree-5.901-TRIAL"
>5.901-TRIAL DEV
  (CJM on 2012-12-22)</option>
<option
  
  value="CJM/HTML-Tree-5.900-TRIAL"
>5.900-TRIAL DEV
  (CJM on 2012-12-15)</option>
<option
  
  value="CJM/HTML-Tree-5.03"
>5.03
  (CJM on 2012-09-23)</option>
<option
  
  value="CJM/HTML-Tree-5.02"
>5.02
  (CJM on 2012-06-27)</option>
<option
  
  value="PETEK/HTML-Tree-3.23"
>3.23
  (PETEK on 2006-11-12)</option>
<option
  
  value="GAAS/HTML-Tree-0.53"
>0.53
  (GAAS on 1999-12-15)</option>
<optgroup label="BackPAN">'
<option
  
  value="CJM/HTML-Tree-5.01"
>5.01
  (CJM on 2012-06-20)</option>
<option
  
  value="CJM/HTML-Tree-5.00"
>5.00
  (CJM on 2012-06-12)</option>
<option
  
  value="CJM/HTML-Tree-4.903-TRIAL"
>4.903-TRIAL DEV
  (CJM on 2012-06-09)</option>
<option
  
  value="CJM/HTML-Tree-4.902-TRIAL"
>4.902-TRIAL DEV
  (CJM on 2012-06-07)</option>
<option
  
  value="CJM/HTML-Tree-4.901-TRIAL"
>4.901-TRIAL DEV
  (CJM on 2012-06-06)</option>
<option
  
  value="CJM/HTML-Tree-4.900-TRIAL"
>4.900-TRIAL DEV
  (CJM on 2012-06-01)</option>
<option
  
  value="JFEARN/HTML-Tree-4.2"
>4.2
  (JFEARN on 2011-04-06)</option>
<option
  
  value="JFEARN/HTML-Tree-4.1"
>4.1
  (JFEARN on 2010-10-25)</option>
<option
  
  value="JFEARN/HTML-Tree-4.0"
>4.0
  (JFEARN on 2010-09-20)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_4"
>3.23_4 DEV
  (JFEARN on 2010-08-30)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_3"
>3.23_3 DEV
  (JFEARN on 2010-08-10)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_2"
>3.23_2 DEV
  (JFEARN on 2010-08-09)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_1"
>3.23_1 DEV
  (JFEARN on 2010-06-21)</option>
<option
  
  value="PETEK/HTML-Tree-3.22"
>3.22
  (PETEK on 2006-11-12)</option>
<option
  
  value="PETEK/HTML-Tree-3.21"
>3.21
  (PETEK on 2006-08-07)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.20"
>3.20
  (PETDANCE on 2006-06-05)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_04"
>3.19_04 DEV
  (PETDANCE on 2006-02-01)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_03"
>3.19_03 DEV
  (PETDANCE on 2005-11-26)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_02"
>3.19_02 DEV
  (PETDANCE on 2005-11-25)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.1901"
>3.1901
  (PETDANCE on 2005-11-09)</option>
<option
  
  value="SBURKE/HTML-Tree-3.18"
>3.18
  (SBURKE on 2003-09-15)</option>
<option
  
  value="SBURKE/HTML-Tree-3.17"
>3.17
  (SBURKE on 2003-01-19)</option>
<option
  
  value="SBURKE/HTML-Tree-3.16"
>3.16
  (SBURKE on 2002-11-23)</option>
<option
  
  value="SBURKE/HTML-Tree-3.15"
>3.15
  (SBURKE on 2002-11-07)</option>
<option
  
  value="SBURKE/HTML-Tree-3.14"
>3.14
  (SBURKE on 2002-10-20)</option>
<option
  
  value="SBURKE/HTML-Tree-3.13"
>3.13
  (SBURKE on 2002-08-16)</option>
<option
  
  value="SBURKE/HTML-Tree-3.12"
>3.12
  (SBURKE on 2002-07-30)</option>
<option
  
  value="SBURKE/HTML-Tree-3.11"
>3.11
  (SBURKE on 2001-03-15)</option>
<option
  
  value="SBURKE/HTML-Tree-3.1"
>3.1
  (SBURKE on 2001-03-11)</option>
<option
  
  value="SBURKE/HTML-Tree-3.09"
>3.09
  (SBURKE on 2001-01-20)</option>
<option
  
  value="SBURKE/HTML-Tree-3.08"
>3.08
  (SBURKE on 2000-11-03)</option>
<option
  
  value="SBURKE/HTML-Tree-3.07"
>3.07
  (SBURKE on 2000-10-21)</option>
<option
  
  value="SBURKE/HTML-Tree-3.06"
>3.06
  (SBURKE on 2000-10-16)</option>
<option
  
  value="SBURKE/HTML-Tree-3.05"
>3.05
  (SBURKE on 2000-10-02)</option>
<option
  
  value="SBURKE/HTML-Tree-3.04"
>3.04
  (SBURKE on 2000-09-04)</option>
<option
  
  value="SBURKE/HTML-Tree-3.03"
>3.03
  (SBURKE on 2000-08-26)</option>
<option
  
  value="SBURKE/HTML-Tree-3.02"
>3.02
  (SBURKE on 2000-08-21)</option>
<option
  
  value="SBURKE/HTML-Tree-3.01"
>3.01
  (SBURKE on 2000-08-21)</option>
<option
  
  value="SBURKE/HTML-Tree-0.68"
>0.68
  (SBURKE on 2000-06-28)</option>
<option
  
  value="SBURKE/HTML-Tree-0.67"
>0.67
  (SBURKE on 2000-06-12)</option>
<option
  
  value="SBURKE/HTML-Tree-0.66"
>0.66
  (SBURKE on 2000-05-19)</option>
<option
  
  value="SBURKE/HTML-Tree-0.65"
>0.65
  (SBURKE on 2000-03-27)</option>
<option
  
  value="SBURKE/HTML-Tree-0.64"
>0.64
  (SBURKE on 2000-03-09)</option>
<option
  
  value="SBURKE/HTML-Tree-0.63"
>0.63
  (SBURKE on 2000-03-08)</option>
<option
  
  value="SBURKE/HTML-Tree-0.62"
>0.62
  (SBURKE on 1999-12-22)</option>
<option
  
  value="SBURKE/HTML-Tree-0.61"
>0.61
  (SBURKE on 1999-12-16)</option>
<option
  
  value="GAAS/HTML-Tree-0.51"
>0.51
  (GAAS on 1998-07-06)</option>
<option
  
  value="GAAS/HTML-Tree-0.50"
>0.50
  (GAAS on 1998-03-31)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/KENTNL/HTML-Tree-5.07/diff/' + encodeURIComponent(this.value) + '/lib/HTML/TreeBuilder.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="KENTNL/HTML-Tree-5.07"
>5.07
  (KENTNL on 2017-08-31)</option>
<option
  
  value="KENTNL/HTML-Tree-5.06"
>5.06
  (KENTNL on 2017-04-28)</option>
<option
  
  value="KENTNL/HTML-Tree-5.910-TRIAL"
>5.910-TRIAL DEV
  (KENTNL on 2017-04-26)</option>
<option
  
  value="KENTNL/HTML-Tree-5.05"
>5.05
  (KENTNL on 2017-04-26)</option>
<option
  
  value="JFEARN/HTML-Tree-5.04"
>5.04
  (JFEARN on 2017-04-18)</option>
<option
  
  value="CJM/HTML-Tree-5.909-TRIAL"
>5.909-TRIAL DEV
  (CJM on 2014-05-24)</option>
<option
  
  value="CJM/HTML-Tree-5.908-TRIAL"
>5.908-TRIAL DEV
  (CJM on 2014-05-17)</option>
<option
  
  value="CJM/HTML-Tree-5.907-TRIAL"
>5.907-TRIAL DEV
  (CJM on 2013-09-14)</option>
<option
  
  value="CJM/HTML-Tree-5.906-TRIAL"
>5.906-TRIAL DEV
  (CJM on 2013-07-13)</option>
<option
  
  value="CJM/HTML-Tree-5.905-TRIAL"
>5.905-TRIAL DEV
  (CJM on 2013-06-29)</option>
<option
  
  value="CJM/HTML-Tree-5.904-TRIAL"
>5.904-TRIAL DEV
  (CJM on 2013-06-08)</option>
<option
  
  value="CJM/HTML-Tree-5.903-TRIAL"
>5.903-TRIAL DEV
  (CJM on 2013-06-01)</option>
<option
  
  value="CJM/HTML-Tree-5.902-TRIAL"
>5.902-TRIAL DEV
  (CJM on 2013-03-02)</option>
<option
  
  value="CJM/HTML-Tree-5.901-TRIAL"
>5.901-TRIAL DEV
  (CJM on 2012-12-22)</option>
<option
  
  value="CJM/HTML-Tree-5.900-TRIAL"
>5.900-TRIAL DEV
  (CJM on 2012-12-15)</option>
<option
  
  value="CJM/HTML-Tree-5.03"
>5.03
  (CJM on 2012-09-23)</option>
<option
  
  value="CJM/HTML-Tree-5.02"
>5.02
  (CJM on 2012-06-27)</option>
<option
  
  value="PETEK/HTML-Tree-3.23"
>3.23
  (PETEK on 2006-11-12)</option>
<option
  
  value="GAAS/HTML-Tree-0.53"
>0.53
  (GAAS on 1999-12-15)</option>
<optgroup label="BackPAN">'
<option
  
  value="CJM/HTML-Tree-5.01"
>5.01
  (CJM on 2012-06-20)</option>
<option
  
  value="CJM/HTML-Tree-5.00"
>5.00
  (CJM on 2012-06-12)</option>
<option
  
  value="CJM/HTML-Tree-4.903-TRIAL"
>4.903-TRIAL DEV
  (CJM on 2012-06-09)</option>
<option
  
  value="CJM/HTML-Tree-4.902-TRIAL"
>4.902-TRIAL DEV
  (CJM on 2012-06-07)</option>
<option
  
  value="CJM/HTML-Tree-4.901-TRIAL"
>4.901-TRIAL DEV
  (CJM on 2012-06-06)</option>
<option
  
  value="CJM/HTML-Tree-4.900-TRIAL"
>4.900-TRIAL DEV
  (CJM on 2012-06-01)</option>
<option
  
  value="JFEARN/HTML-Tree-4.2"
>4.2
  (JFEARN on 2011-04-06)</option>
<option
  
  value="JFEARN/HTML-Tree-4.1"
>4.1
  (JFEARN on 2010-10-25)</option>
<option
  
  value="JFEARN/HTML-Tree-4.0"
>4.0
  (JFEARN on 2010-09-20)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_4"
>3.23_4 DEV
  (JFEARN on 2010-08-30)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_3"
>3.23_3 DEV
  (JFEARN on 2010-08-10)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_2"
>3.23_2 DEV
  (JFEARN on 2010-08-09)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_1"
>3.23_1 DEV
  (JFEARN on 2010-06-21)</option>
<option
  
  value="PETEK/HTML-Tree-3.22"
>3.22
  (PETEK on 2006-11-12)</option>
<option
  
  value="PETEK/HTML-Tree-3.21"
>3.21
  (PETEK on 2006-08-07)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.20"
>3.20
  (PETDANCE on 2006-06-05)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_04"
>3.19_04 DEV
  (PETDANCE on 2006-02-01)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_03"
>3.19_03 DEV
  (PETDANCE on 2005-11-26)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_02"
>3.19_02 DEV
  (PETDANCE on 2005-11-25)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.1901"
>3.1901
  (PETDANCE on 2005-11-09)</option>
<option
  
  value="SBURKE/HTML-Tree-3.18"
>3.18
  (SBURKE on 2003-09-15)</option>
<option
  
  value="SBURKE/HTML-Tree-3.17"
>3.17
  (SBURKE on 2003-01-19)</option>
<option
  
  value="SBURKE/HTML-Tree-3.16"
>3.16
  (SBURKE on 2002-11-23)</option>
<option
  
  value="SBURKE/HTML-Tree-3.15"
>3.15
  (SBURKE on 2002-11-07)</option>
<option
  
  value="SBURKE/HTML-Tree-3.14"
>3.14
  (SBURKE on 2002-10-20)</option>
<option
  
  value="SBURKE/HTML-Tree-3.13"
>3.13
  (SBURKE on 2002-08-16)</option>
<option
  
  value="SBURKE/HTML-Tree-3.12"
>3.12
  (SBURKE on 2002-07-30)</option>
<option
  
  value="SBURKE/HTML-Tree-3.11"
>3.11
  (SBURKE on 2001-03-15)</option>
<option
  
  value="SBURKE/HTML-Tree-3.1"
>3.1
  (SBURKE on 2001-03-11)</option>
<option
  
  value="SBURKE/HTML-Tree-3.09"
>3.09
  (SBURKE on 2001-01-20)</option>
<option
  
  value="SBURKE/HTML-Tree-3.08"
>3.08
  (SBURKE on 2000-11-03)</option>
<option
  
  value="SBURKE/HTML-Tree-3.07"
>3.07
  (SBURKE on 2000-10-21)</option>
<option
  
  value="SBURKE/HTML-Tree-3.06"
>3.06
  (SBURKE on 2000-10-16)</option>
<option
  
  value="SBURKE/HTML-Tree-3.05"
>3.05
  (SBURKE on 2000-10-02)</option>
<option
  
  value="SBURKE/HTML-Tree-3.04"
>3.04
  (SBURKE on 2000-09-04)</option>
<option
  
  value="SBURKE/HTML-Tree-3.03"
>3.03
  (SBURKE on 2000-08-26)</option>
<option
  
  value="SBURKE/HTML-Tree-3.02"
>3.02
  (SBURKE on 2000-08-21)</option>
<option
  
  value="SBURKE/HTML-Tree-3.01"
>3.01
  (SBURKE on 2000-08-21)</option>
<option
  
  value="SBURKE/HTML-Tree-0.68"
>0.68
  (SBURKE on 2000-06-28)</option>
<option
  
  value="SBURKE/HTML-Tree-0.67"
>0.67
  (SBURKE on 2000-06-12)</option>
<option
  
  value="SBURKE/HTML-Tree-0.66"
>0.66
  (SBURKE on 2000-05-19)</option>
<option
  
  value="SBURKE/HTML-Tree-0.65"
>0.65
  (SBURKE on 2000-03-27)</option>
<option
  
  value="SBURKE/HTML-Tree-0.64"
>0.64
  (SBURKE on 2000-03-09)</option>
<option
  
  value="SBURKE/HTML-Tree-0.63"
>0.63
  (SBURKE on 2000-03-08)</option>
<option
  
  value="SBURKE/HTML-Tree-0.62"
>0.62
  (SBURKE on 1999-12-22)</option>
<option
  
  value="SBURKE/HTML-Tree-0.61"
>0.61
  (SBURKE on 1999-12-16)</option>
<option
  
  value="GAAS/HTML-Tree-0.51"
>0.51
  (GAAS on 1998-07-06)</option>
<option
  
  value="GAAS/HTML-Tree-0.50"
>0.50
  (GAAS on 1998-03-31)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/Carp" title="Carp" class="ellipsis">Carp</a></li>
  <li><a href="https://metacpan.org/pod/Exporter" title="Exporter" class="ellipsis">Exporter</a></li>
  <li><a href="./HTML::Entities.html" title="HTML::Entities" class="ellipsis">HTML::Entities</a></li>
  <li><a href="./HTML::Parser.html" title="HTML::Parser" class="ellipsis">HTML::Parser</a></li>
  <li><a href="https://metacpan.org/pod/HTML::Tagset" title="HTML::Tagset" class="ellipsis">HTML::Tagset</a></li>
  <li><a href="https://metacpan.org/pod/Scalar::Util" title="Scalar::Util" class="ellipsis">Scalar::Util</a></li>
  <li><a href="https://metacpan.org/pod/integer" title="integer" class="ellipsis">integer</a></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/HTML::TreeBuilder/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=HTML%3A%3ATreeBuilder">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=HTML-Tree">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/KENTNL/HTML-Tree-5.07/view/lib/HTML/TreeBuilder.pm">This version</a>
    </li>
    <li>
      <a href="./HTML::TreeBuilder.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/PWBENNETT"><img src="https://www.gravatar.com/avatar/41a085cce4a7061cf4ee49d02b9bed0e?d=identicon&amp;s=20" title="PWBENNETT" alt="PWBENNETT"></a>
<a class="display-all" href="https://metacpan.org/author/MISHIN"><img src="https://www.gravatar.com/avatar/7aefe037fc617ef89780ad89de3deb87?d=identicon&amp;s=20" title="MISHIN" alt="MISHIN"></a>
<a class="display-all" href="https://metacpan.org/author/SZABGAB"><img src="https://www.gravatar.com/avatar/4e0a6fe2acda5df6095514e7d6329e91?d=identicon&amp;s=20" title="SZABGAB" alt="SZABGAB"></a>
<a class="display-all" href="https://metacpan.org/author/SEBKIRCHE"><img src="https://www.gravatar.com/avatar/80ae61c676b34229101fd7b0929831bb?d=identicon&amp;s=20" title="SEBKIRCHE" alt="SEBKIRCHE"></a>
<a class="display-all" href="https://metacpan.org/author/FANY"><img src="https://www.gravatar.com/avatar/7bc0edaceda1cb0a5b56b844a5b406c2?d=identicon&amp;s=20" title="FANY" alt="FANY"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/HTML-Tree/plussers">15 PAUSE users</a>
</div>
<div>
    20 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 2 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
      data-cpan-author="CJM"
      data-contrib-email="perl@cjmweb.net"
    >
      <a href="https://metacpan.org/author/CJM" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/75ab2425a09e84ffc650a859523ac56a?d=identicon&amp;s=20" />
      Christopher J. Madsen
      </a>
    </li>
    <li class="contributor"
      data-cpan-author="JFEARN"
      data-contrib-email="jfearn@cpan.org"
    >
      <a href="https://metacpan.org/author/JFEARN" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/aa628f71c8b783d6c4c732f4037cfd44?d=identicon&amp;s=20" />
      Jeff Fearn
      </a>
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/KENTNL" class="author-name">Kent Fredric (PAUSE Custodial Account)</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/HTML/TreeBuilder.pm&#39;" class="">
<option
  selected
  value="KENTNL/HTML-Tree-5.07"
>5.07
  (KENTNL on 2017-08-31)</option>
<option
  
  value="KENTNL/HTML-Tree-5.06"
>5.06
  (KENTNL on 2017-04-28)</option>
<option
  
  value="KENTNL/HTML-Tree-5.910-TRIAL"
>5.910-TRIAL DEV
  (KENTNL on 2017-04-26)</option>
<option
  
  value="KENTNL/HTML-Tree-5.05"
>5.05
  (KENTNL on 2017-04-26)</option>
<option
  
  value="JFEARN/HTML-Tree-5.04"
>5.04
  (JFEARN on 2017-04-18)</option>
<option
  
  value="CJM/HTML-Tree-5.909-TRIAL"
>5.909-TRIAL DEV
  (CJM on 2014-05-24)</option>
<option
  
  value="CJM/HTML-Tree-5.908-TRIAL"
>5.908-TRIAL DEV
  (CJM on 2014-05-17)</option>
<option
  
  value="CJM/HTML-Tree-5.907-TRIAL"
>5.907-TRIAL DEV
  (CJM on 2013-09-14)</option>
<option
  
  value="CJM/HTML-Tree-5.906-TRIAL"
>5.906-TRIAL DEV
  (CJM on 2013-07-13)</option>
<option
  
  value="CJM/HTML-Tree-5.905-TRIAL"
>5.905-TRIAL DEV
  (CJM on 2013-06-29)</option>
<option
  
  value="CJM/HTML-Tree-5.904-TRIAL"
>5.904-TRIAL DEV
  (CJM on 2013-06-08)</option>
<option
  
  value="CJM/HTML-Tree-5.903-TRIAL"
>5.903-TRIAL DEV
  (CJM on 2013-06-01)</option>
<option
  
  value="CJM/HTML-Tree-5.902-TRIAL"
>5.902-TRIAL DEV
  (CJM on 2013-03-02)</option>
<option
  
  value="CJM/HTML-Tree-5.901-TRIAL"
>5.901-TRIAL DEV
  (CJM on 2012-12-22)</option>
<option
  
  value="CJM/HTML-Tree-5.900-TRIAL"
>5.900-TRIAL DEV
  (CJM on 2012-12-15)</option>
<option
  
  value="CJM/HTML-Tree-5.03"
>5.03
  (CJM on 2012-09-23)</option>
<option
  
  value="CJM/HTML-Tree-5.02"
>5.02
  (CJM on 2012-06-27)</option>
<option
  
  value="PETEK/HTML-Tree-3.23"
>3.23
  (PETEK on 2006-11-12)</option>
<option
  
  value="GAAS/HTML-Tree-0.53"
>0.53
  (GAAS on 1999-12-15)</option>
<optgroup label="BackPAN">'
<option
  
  value="CJM/HTML-Tree-5.01"
>5.01
  (CJM on 2012-06-20)</option>
<option
  
  value="CJM/HTML-Tree-5.00"
>5.00
  (CJM on 2012-06-12)</option>
<option
  
  value="CJM/HTML-Tree-4.903-TRIAL"
>4.903-TRIAL DEV
  (CJM on 2012-06-09)</option>
<option
  
  value="CJM/HTML-Tree-4.902-TRIAL"
>4.902-TRIAL DEV
  (CJM on 2012-06-07)</option>
<option
  
  value="CJM/HTML-Tree-4.901-TRIAL"
>4.901-TRIAL DEV
  (CJM on 2012-06-06)</option>
<option
  
  value="CJM/HTML-Tree-4.900-TRIAL"
>4.900-TRIAL DEV
  (CJM on 2012-06-01)</option>
<option
  
  value="JFEARN/HTML-Tree-4.2"
>4.2
  (JFEARN on 2011-04-06)</option>
<option
  
  value="JFEARN/HTML-Tree-4.1"
>4.1
  (JFEARN on 2010-10-25)</option>
<option
  
  value="JFEARN/HTML-Tree-4.0"
>4.0
  (JFEARN on 2010-09-20)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_4"
>3.23_4 DEV
  (JFEARN on 2010-08-30)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_3"
>3.23_3 DEV
  (JFEARN on 2010-08-10)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_2"
>3.23_2 DEV
  (JFEARN on 2010-08-09)</option>
<option
  
  value="JFEARN/HTML-Tree-3.23_1"
>3.23_1 DEV
  (JFEARN on 2010-06-21)</option>
<option
  
  value="PETEK/HTML-Tree-3.22"
>3.22
  (PETEK on 2006-11-12)</option>
<option
  
  value="PETEK/HTML-Tree-3.21"
>3.21
  (PETEK on 2006-08-07)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.20"
>3.20
  (PETDANCE on 2006-06-05)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_04"
>3.19_04 DEV
  (PETDANCE on 2006-02-01)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_03"
>3.19_03 DEV
  (PETDANCE on 2005-11-26)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.19_02"
>3.19_02 DEV
  (PETDANCE on 2005-11-25)</option>
<option
  
  value="PETDANCE/HTML-Tree-3.1901"
>3.1901
  (PETDANCE on 2005-11-09)</option>
<option
  
  value="SBURKE/HTML-Tree-3.18"
>3.18
  (SBURKE on 2003-09-15)</option>
<option
  
  value="SBURKE/HTML-Tree-3.17"
>3.17
  (SBURKE on 2003-01-19)</option>
<option
  
  value="SBURKE/HTML-Tree-3.16"
>3.16
  (SBURKE on 2002-11-23)</option>
<option
  
  value="SBURKE/HTML-Tree-3.15"
>3.15
  (SBURKE on 2002-11-07)</option>
<option
  
  value="SBURKE/HTML-Tree-3.14"
>3.14
  (SBURKE on 2002-10-20)</option>
<option
  
  value="SBURKE/HTML-Tree-3.13"
>3.13
  (SBURKE on 2002-08-16)</option>
<option
  
  value="SBURKE/HTML-Tree-3.12"
>3.12
  (SBURKE on 2002-07-30)</option>
<option
  
  value="SBURKE/HTML-Tree-3.11"
>3.11
  (SBURKE on 2001-03-15)</option>
<option
  
  value="SBURKE/HTML-Tree-3.1"
>3.1
  (SBURKE on 2001-03-11)</option>
<option
  
  value="SBURKE/HTML-Tree-3.09"
>3.09
  (SBURKE on 2001-01-20)</option>
<option
  
  value="SBURKE/HTML-Tree-3.08"
>3.08
  (SBURKE on 2000-11-03)</option>
<option
  
  value="SBURKE/HTML-Tree-3.07"
>3.07
  (SBURKE on 2000-10-21)</option>
<option
  
  value="SBURKE/HTML-Tree-3.06"
>3.06
  (SBURKE on 2000-10-16)</option>
<option
  
  value="SBURKE/HTML-Tree-3.05"
>3.05
  (SBURKE on 2000-10-02)</option>
<option
  
  value="SBURKE/HTML-Tree-3.04"
>3.04
  (SBURKE on 2000-09-04)</option>
<option
  
  value="SBURKE/HTML-Tree-3.03"
>3.03
  (SBURKE on 2000-08-26)</option>
<option
  
  value="SBURKE/HTML-Tree-3.02"
>3.02
  (SBURKE on 2000-08-21)</option>
<option
  
  value="SBURKE/HTML-Tree-3.01"
>3.01
  (SBURKE on 2000-08-21)</option>
<option
  
  value="SBURKE/HTML-Tree-0.68"
>0.68
  (SBURKE on 2000-06-28)</option>
<option
  
  value="SBURKE/HTML-Tree-0.67"
>0.67
  (SBURKE on 2000-06-12)</option>
<option
  
  value="SBURKE/HTML-Tree-0.66"
>0.66
  (SBURKE on 2000-05-19)</option>
<option
  
  value="SBURKE/HTML-Tree-0.65"
>0.65
  (SBURKE on 2000-03-27)</option>
<option
  
  value="SBURKE/HTML-Tree-0.64"
>0.64
  (SBURKE on 2000-03-09)</option>
<option
  
  value="SBURKE/HTML-Tree-0.63"
>0.63
  (SBURKE on 2000-03-08)</option>
<option
  
  value="SBURKE/HTML-Tree-0.62"
>0.62
  (SBURKE on 1999-12-22)</option>
<option
  
  value="SBURKE/HTML-Tree-0.61"
>0.61
  (SBURKE on 1999-12-16)</option>
<option
  
  value="GAAS/HTML-Tree-0.51"
>0.51
  (GAAS on 1998-07-06)</option>
<option
  
  value="GAAS/HTML-Tree-0.50"
>0.50
  (GAAS on 1998-03-31)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/HTML-Tree">HTML-Tree-5.07</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage three &#10;
          • 171 direct dependents &#10;          • 974 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="HTML-Tree-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="HTML-Tree-5.07">
    <input type="hidden" name="author" value="KENTNL">
    <input type="hidden" name="distribution" value="HTML-Tree">
    <button type="submit" class="favorite highlight"><span>35</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./HTML::TreeBuilder.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>35</span> ++</a>
</div>
   / <span>HTML::TreeBuilder</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./HTML::TreeBuilder.html#NAME">NAME</a></li>
  <li><a href="./HTML::TreeBuilder.html#VERSION">VERSION</a></li>
  <li><a href="./HTML::TreeBuilder.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./HTML::TreeBuilder.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./HTML::TreeBuilder.html#ATTRIBUTES">ATTRIBUTES</a>
    <ul>
      <li><a href="./HTML::TreeBuilder.html#implicit_tags">implicit_tags</a></li>
      <li><a href="./HTML::TreeBuilder.html#implicit_body_p_tag">implicit_body_p_tag</a></li>
      <li><a href="./HTML::TreeBuilder.html#no_expand_entities">no_expand_entities</a></li>
      <li><a href="./HTML::TreeBuilder.html#ignore_unknown">ignore_unknown</a></li>
      <li><a href="./HTML::TreeBuilder.html#ignore_text">ignore_text</a></li>
      <li><a href="./HTML::TreeBuilder.html#ignore_ignorable_whitespace">ignore_ignorable_whitespace</a></li>
      <li><a href="./HTML::TreeBuilder.html#no_space_compacting">no_space_compacting</a></li>
      <li><a href="./HTML::TreeBuilder.html#p_strict">p_strict</a></li>
      <li><a href="./HTML::TreeBuilder.html#store_comments">store_comments</a></li>
      <li><a href="./HTML::TreeBuilder.html#store_declarations">store_declarations</a></li>
      <li><a href="./HTML::TreeBuilder.html#store_pis">store_pis</a></li>
      <li><a href="./HTML::TreeBuilder.html#warn">warn</a></li>
    </ul>
  </li>
  <li><a href="./HTML::TreeBuilder.html#METHODS">METHODS</a>
    <ul>
      <li><a href="./HTML::TreeBuilder.html#new_from_file">new_from_file</a></li>
      <li><a href="./HTML::TreeBuilder.html#new_from_content">new_from_content</a></li>
      <li><a href="./HTML::TreeBuilder.html#new_from_url">new_from_url</a></li>
      <li><a href="./HTML::TreeBuilder.html#new">new</a></li>
      <li><a href="./HTML::TreeBuilder.html#parse_file">parse_file</a></li>
      <li><a href="./HTML::TreeBuilder.html#parse">parse</a></li>
      <li><a href="./HTML::TreeBuilder.html#eof">eof</a></li>
      <li><a href="./HTML::TreeBuilder.html#parse_content">parse_content</a></li>
      <li><a href="./HTML::TreeBuilder.html#delete">delete</a></li>
      <li><a href="./HTML::TreeBuilder.html#elementify">elementify</a></li>
      <li><a href="./HTML::TreeBuilder.html#guts">guts</a></li>
      <li><a href="./HTML::TreeBuilder.html#disembowel">disembowel</a></li>
    </ul>
  </li>
  <li><a href="./HTML::TreeBuilder.html#INTERNAL-METHODS">INTERNAL METHODS</a>
    <ul>
      <li><a href="./HTML::TreeBuilder.html#element_class">element_class</a></li>
      <li><a href="./HTML::TreeBuilder.html#comment">comment</a></li>
      <li><a href="./HTML::TreeBuilder.html#declaration">declaration</a></li>
      <li><a href="./HTML::TreeBuilder.html#done">done</a></li>
      <li><a href="./HTML::TreeBuilder.html#end">end</a></li>
      <li><a href="./HTML::TreeBuilder.html#process">process</a></li>
      <li><a href="./HTML::TreeBuilder.html#start">start</a></li>
      <li><a href="./HTML::TreeBuilder.html#stunt">stunt</a></li>
      <li><a href="./HTML::TreeBuilder.html#stunted">stunted</a></li>
      <li><a href="./HTML::TreeBuilder.html#text">text</a></li>
      <li><a href="./HTML::TreeBuilder.html#tighten_up">tighten_up</a></li>
      <li><a href="./HTML::TreeBuilder.html#warning">warning</a></li>
    </ul>
  </li>
  <li><a href="./HTML::TreeBuilder.html#SUBROUTINES">SUBROUTINES</a>
    <ul>
      <li><a href="./HTML::TreeBuilder.html#DEBUG">DEBUG</a></li>
    </ul>
  </li>
  <li><a href="./HTML::TreeBuilder.html#HTML-AND-ITS-DISCONTENTS">HTML AND ITS DISCONTENTS</a></li>
  <li><a href="./HTML::TreeBuilder.html#TRANSLATIONS?">TRANSLATIONS?</a></li>
  <li><a href="./HTML::TreeBuilder.html#BUGS">BUGS</a></li>
  <li><a href="./HTML::TreeBuilder.html#BUG-REPORTS">BUG REPORTS</a></li>
  <li><a href="./HTML::TreeBuilder.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./HTML::TreeBuilder.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./HTML::TreeBuilder.html#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>HTML::TreeBuilder - Parser that builds a HTML syntax tree</p>

<h1 id="VERSION">VERSION</h1>

<p>This document describes version 5.07 of HTML::TreeBuilder, released August 31, 2017 as part of <a href="https://metacpan.org/pod/HTML::Tree">HTML-Tree</a>.</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>  use HTML::TreeBuilder 5 -weak; # Ensure weak references in use

  foreach my $file_name (@ARGV) {
    my $tree = HTML::TreeBuilder-&gt;new; # empty tree
    $tree-&gt;parse_file($file_name);
    print &quot;Hey, here&#39;s a dump of the parse tree of $file_name:\n&quot;;
    $tree-&gt;dump; # a method we inherit from HTML::Element
    print &quot;And here it is, bizarrely rerendered as HTML:\n&quot;,
      $tree-&gt;as_HTML, &quot;\n&quot;;

    # Now that we&#39;re done with it, we must destroy it.
    # $tree = $tree-&gt;delete; # Not required with weak references
  }</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>(This class is part of the <a href="https://metacpan.org/pod/HTML::Tree">HTML::Tree</a> dist.)</p>

<p>This class is for HTML syntax trees that get built out of HTML source. The way to use it is to:</p>

<p>1. start a new (empty) HTML::TreeBuilder object,</p>

<p>2. then use one of the methods from HTML::Parser (presumably with <code>$tree-&gt;parse_file($filename)</code> for files, or with <code>$tree-&gt;parse($document_content)</code> and <code>$tree-&gt;eof</code> if you&#39;ve got the content in a string) to parse the HTML document into the tree <code>$tree</code>.</p>

<p>(You can combine steps 1 and 2 with the &quot;new_from_file&quot; or &quot;new_from_content&quot; methods.)</p>

<p>2b. call <code>$root-&gt;elementify()</code> if you want.</p>

<p>3. do whatever you need to do with the syntax tree, presumably involving traversing it looking for some bit of information in it,</p>

<p>4. previous versions of HTML::TreeBuilder required you to call <code>$tree-&gt;delete()</code> to erase the contents of the tree from memory when you&#39;re done with the tree. This is not normally required anymore. See <a href="https://metacpan.org/pod/HTML::Element#Weak-References">&quot;Weak References&quot; in HTML::Element</a> for details.</p>

<h1 id="ATTRIBUTES">ATTRIBUTES</h1>

<p>Most of the following attributes native to HTML::TreeBuilder control how parsing takes place; they should be set <i>before</i> you try parsing into the given object. You can set the attributes by passing a TRUE or FALSE value as argument. E.g., <code>$root-&gt;implicit_tags</code> returns the current setting for the <code>implicit_tags</code> option, <code>$root-&gt;implicit_tags(1)</code> turns that option on, and <code>$root-&gt;implicit_tags(0)</code> turns it off.</p>

<h2 id="implicit_tags">implicit_tags</h2>

<p>Setting this attribute to true will instruct the parser to try to deduce implicit elements and implicit end tags. If it is false you get a parse tree that just reflects the text as it stands, which is unlikely to be useful for anything but quick and dirty parsing. (In fact, I&#39;d be curious to hear from anyone who finds it useful to have <code>implicit_tags</code> set to false.) Default is true.</p>

<p>Implicit elements have the <a href="https://metacpan.org/pod/HTML::Element#implicit">&quot;implicit&quot; in HTML::Element</a> attribute set.</p>

<h2 id="implicit_body_p_tag">implicit_body_p_tag</h2>

<p>This controls an aspect of implicit element behavior, if <code>implicit_tags</code> is on: If a text element (PCDATA) or a phrasal element (such as <code>&lt;em&gt;</code>) is to be inserted under <code>&lt;body&gt;</code>, two things can happen: if <code>implicit_body_p_tag</code> is true, it&#39;s placed under a new, implicit <code>&lt;p&gt;</code> tag. (Past DTDs suggested this was the only correct behavior, and this is how past versions of this module behaved.) But if <code>implicit_body_p_tag</code> is false, nothing is implicated -- the PCDATA or phrasal element is simply placed under <code>&lt;body&gt;</code>. Default is false.</p>

<h2 id="no_expand_entities">no_expand_entities</h2>

<p>This attribute controls whether entities are decoded during the initial parse of the source. Enable this if you don&#39;t want entities decoded to their character value. e.g. &#39;&amp;amp;&#39; is decoded to &#39;&amp;&#39; by default, but will be unchanged if this is enabled. Default is false (entities will be decoded.)</p>

<h2 id="ignore_unknown">ignore_unknown</h2>

<p>This attribute controls whether unknown tags should be represented as elements in the parse tree, or whether they should be ignored. Default is true (to ignore unknown tags.)</p>

<h2 id="ignore_text">ignore_text</h2>

<p>Do not represent the text content of elements. This saves space if all you want is to examine the structure of the document. Default is false.</p>

<h2 id="ignore_ignorable_whitespace">ignore_ignorable_whitespace</h2>

<p>If set to true, TreeBuilder will try to avoid creating ignorable whitespace text nodes in the tree. Default is true. (In fact, I&#39;d be interested in hearing if there&#39;s ever a case where you need this off, or where leaving it on leads to incorrect behavior.)</p>

<h2 id="no_space_compacting">no_space_compacting</h2>

<p>This determines whether TreeBuilder compacts all whitespace strings in the document (well, outside of PRE or TEXTAREA elements), or leaves them alone. Normally (default, value of 0), each string of contiguous whitespace in the document is turned into a single space. But that&#39;s not done if <code>no_space_compacting</code> is set to 1.</p>

<p>Setting <code>no_space_compacting</code> to 1 might be useful if you want to read in a tree just to make some minor changes to it before writing it back out.</p>

<p>This method is experimental. If you use it, be sure to report any problems you might have with it.</p>

<h2 id="p_strict">p_strict</h2>

<p>If set to true (and it defaults to false), TreeBuilder will take a narrower than normal view of what can be under a <code>&lt;p&gt;</code> element; if it sees a non-phrasal element about to be inserted under a <code>&lt;p&gt;</code>, it will close that <code>&lt;p&gt;</code>. Otherwise it will close <code>&lt;p&gt;</code> elements only for other <code>&lt;p&gt;</code>&#39;s, headings, and <code>&lt;form&gt;</code> (although the latter may be removed in future versions).</p>

<p>For example, when going thru this snippet of code,</p>

<pre><code>  &lt;p&gt;stuff
  &lt;ul&gt;</code></pre>

<p>TreeBuilder will normally (with <code>p_strict</code> false) put the <code>&lt;ul&gt;</code> element under the <code>&lt;p&gt;</code> element. However, with <code>p_strict</code> set to true, it will close the <code>&lt;p&gt;</code> first.</p>

<p>In theory, there should be strictness options like this for other/all elements besides just <code>&lt;p&gt;</code>; but I treat this as a special case simply because of the fact that <code>&lt;p&gt;</code> occurs so frequently and its end-tag is omitted so often; and also because application of strictness rules at parse-time across all elements often makes tiny errors in HTML coding produce drastically bad parse-trees, in my experience.</p>

<p>If you find that you wish you had an option like this to enforce content-models on all elements, then I suggest that what you want is content-model checking as a stage after TreeBuilder has finished parsing.</p>

<h2 id="store_comments">store_comments</h2>

<p>This determines whether TreeBuilder will normally store comments found while parsing content into <code>$root</code>. Currently, this is off by default.</p>

<h2 id="store_declarations">store_declarations</h2>

<p>This determines whether TreeBuilder will normally store markup declarations found while parsing content into <code>$root</code>. This is on by default.</p>

<h2 id="store_pis">store_pis</h2>

<p>This determines whether TreeBuilder will normally store processing instructions found while parsing content into <code>$root</code> -- assuming a recent version of HTML::Parser (old versions won&#39;t parse PIs correctly). Currently, this is off (false) by default.</p>

<p>It is somewhat of a known bug (to be fixed one of these days, if anyone needs it?) that PIs in the preamble (before the <code>&lt;html&gt;</code> start-tag) end up actually <i>under</i> the <code>&lt;html&gt;</code> element.</p>

<h2 id="warn">warn</h2>

<p>This determines whether syntax errors during parsing should generate warnings, emitted via Perl&#39;s <code>warn</code> function.</p>

<p>This is off (false) by default.</p>

<h1 id="METHODS">METHODS</h1>

<p>Objects of this class inherit the methods of both HTML::Parser and HTML::Element. The methods inherited from HTML::Parser are used for building the HTML tree, and the methods inherited from HTML::Element are what you use to scrutinize the tree. Besides this (HTML::TreeBuilder) documentation, you must also carefully read the HTML::Element documentation, and also skim the HTML::Parser documentation -- probably only its parse and parse_file methods are of interest.</p>

<h2 id="new_from_file">new_from_file</h2>

<pre><code>  $root = HTML::TreeBuilder-&gt;new_from_file($filename_or_filehandle);</code></pre>

<p>This &quot;shortcut&quot; constructor merely combines constructing a new object (with the <a href="./HTML::TreeBuilder.html#new">&quot;new&quot;</a> method, below), and calling <code>$new-&gt;parse_file(...)</code> on it. Returns the new object. Note that this provides no way of setting any parse options like <code>store_comments</code> (for that, call <code>new</code>, and then set options, before calling <code>parse_file</code>). See the notes (below) on parameters to <a href="./HTML::TreeBuilder.html#parse_file">&quot;parse_file&quot;</a>.</p>

<p>If HTML::TreeBuilder is unable to read the file, then <code>new_from_file</code> dies. The error can also be found in <code>$!</code>. (This behavior is new in HTML-Tree 5. Previous versions returned a tree with only implicit elements.)</p>

<h2 id="new_from_content">new_from_content</h2>

<pre><code>  $root = HTML::TreeBuilder-&gt;new_from_content(...);</code></pre>

<p>This &quot;shortcut&quot; constructor merely combines constructing a new object (with the <a href="./HTML::TreeBuilder.html#new">&quot;new&quot;</a> method, below), and calling <code>for(...){$new-&gt;parse($_)}</code> and <code>$new-&gt;eof</code> on it. Returns the new object. Note that this provides no way of setting any parse options like <code>store_comments</code> (for that, call <code>new</code>, and then set options, before calling <code>parse</code>). Example usages: <code>HTML::TreeBuilder-&gt;new_from_content(@lines)</code>, or <code>HTML::TreeBuilder-&gt;new_from_content($content)</code>.</p>

<h2 id="new_from_url">new_from_url</h2>

<pre><code>  $root = HTML::TreeBuilder-&gt;new_from_url($url)</code></pre>

<p>This &quot;shortcut&quot; constructor combines constructing a new object (with the <a href="./HTML::TreeBuilder.html#new">&quot;new&quot;</a> method, below), loading <a href="./LWP::UserAgent.html">LWP::UserAgent</a>, fetching the specified URL, and calling <code>$new-&gt;parse( $response-&gt;decoded_content)</code> and <code>$new-&gt;eof</code> on it. Returns the new object. Note that this provides no way of setting any parse options like <code>store_comments</code>.</p>

<p>If LWP is unable to fetch the URL, or the response is not HTML (as determined by <a href="https://metacpan.org/pod/HTTP::Headers#content_is_html">&quot;content_is_html&quot; in HTTP::Headers</a>), then <code>new_from_url</code> dies, and the HTTP::Response object is found in <code>$HTML::TreeBuilder::lwp_response</code>.</p>

<p>You must have installed LWP::UserAgent for this method to work. LWP is not installed automatically, because it&#39;s a large set of modules and you might not need it.</p>

<h2 id="new">new</h2>

<pre><code>  $root = HTML::TreeBuilder-&gt;new();</code></pre>

<p>This creates a new HTML::TreeBuilder object. This method takes no attributes.</p>

<h2 id="parse_file">parse_file</h2>

<pre><code> $root-&gt;parse_file(...)</code></pre>

<p>[An important method inherited from <a href="./HTML::Parser.html">HTML::Parser</a>, which see. Current versions of HTML::Parser can take a filespec, or a filehandle object, like *FOO, or some object from class IO::Handle, IO::File, IO::Socket) or the like. I think you should check that a given file exists <i>before</i> calling <code>$root-&gt;parse_file($filespec)</code>.]</p>

<p>When you pass a filename to <code>parse_file</code>, HTML::Parser opens it in binary mode, which means it&#39;s interpreted as Latin-1 (ISO-8859-1). If the file is in another encoding, like UTF-8 or UTF-16, this will not do the right thing.</p>

<p>One solution is to open the file yourself using the proper <code>:encoding</code> layer, and pass the filehandle to <code>parse_file</code>. You can automate this process by using <a href="https://metacpan.org/pod/IO::HTML#html_file">&quot;html_file&quot; in IO::HTML</a>, which will use the HTML5 encoding sniffing algorithm to automatically determine the proper <code>:encoding</code> layer and apply it.</p>

<p>In the next major release of HTML-Tree, I plan to have it use IO::HTML automatically. If you really want your file opened in binary mode, you should open it yourself and pass the filehandle to <code>parse_file</code>.</p>

<p>The return value is <code>undef</code> if there&#39;s an error opening the file. In that case, the error will be in <code>$!</code>.</p>

<h2 id="parse">parse</h2>

<pre><code>  $root-&gt;parse(...)</code></pre>

<p>[A important method inherited from <a href="./HTML::Parser.html">HTML::Parser</a>, which see. See the note below for <code>$root-&gt;eof()</code>.]</p>

<h2 id="eof">eof</h2>

<pre><code>  $root-&gt;eof();</code></pre>

<p>This signals that you&#39;re finished parsing content into this tree; this runs various kinds of crucial cleanup on the tree. This is called <i>for you</i> when you call <code>$root-&gt;parse_file(...)</code>, but not when you call <code>$root-&gt;parse(...)</code>. So if you call <code>$root-&gt;parse(...)</code>, then you <i>must</i> call <code>$root-&gt;eof()</code> once you&#39;ve finished feeding all the chunks to <code>parse(...)</code>, and before you actually start doing anything else with the tree in <code>$root</code>.</p>

<h2 id="parse_content">parse_content</h2>

<pre><code>  $root-&gt;parse_content(...);</code></pre>

<p>Basically a handy alias for <code>$root-&gt;parse(...); $root-&gt;eof</code>. Takes the exact same arguments as <code>$root-&gt;parse()</code>.</p>

<h2 id="delete">delete</h2>

<pre><code>  $root-&gt;delete();</code></pre>

<p>[A previously important method inherited from <a href="https://metacpan.org/pod/HTML::Element">HTML::Element</a>, which see.]</p>

<h2 id="elementify">elementify</h2>

<pre><code>  $root-&gt;elementify();</code></pre>

<p>This changes the class of the object in <code>$root</code> from HTML::TreeBuilder to the class used for all the rest of the elements in that tree (generally HTML::Element). Returns <code>$root</code>.</p>

<p>For most purposes, this is unnecessary, but if you call this after (after!!) you&#39;ve finished building a tree, then it keeps you from accidentally trying to call anything but HTML::Element methods on it. (I.e., if you accidentally call <code>$root-&gt;parse_file(...)</code> on the already-complete and elementified tree, then instead of charging ahead and <i>wreaking havoc</i>, it&#39;ll throw a fatal error -- since <code>$root</code> is now an object just of class HTML::Element which has no <code>parse_file</code> method.</p>

<p>Note that <code>elementify</code> currently deletes all the private attributes of <code>$root</code> except for &quot;_tag&quot;, &quot;_parent&quot;, &quot;_content&quot;, &quot;_pos&quot;, and &quot;_implicit&quot;. If anyone requests that I change this to leave in yet more private attributes, I might do so, in future versions.</p>

<h2 id="guts">guts</h2>

<pre><code> @nodes = $root-&gt;guts();
 $parent_for_nodes = $root-&gt;guts();</code></pre>

<p>In list context (as in the first case), this method returns the topmost non-implicit nodes in a tree. This is useful when you&#39;re parsing HTML code that you know doesn&#39;t expect an HTML document, but instead just a fragment of an HTML document. For example, if you wanted the parse tree for a file consisting of just this:</p>

<pre><code>  &lt;li&gt;I like pie!</code></pre>

<p>Then you would get that with <code>@nodes = $root-&gt;guts();</code>. It so happens that in this case, <code>@nodes</code> will contain just one element object, representing the <code>&lt;li&gt;</code> node (with &quot;I like pie!&quot; being its text child node). However, consider if you were parsing this:</p>

<pre><code>  &lt;hr&gt;Hooboy!&lt;hr&gt;</code></pre>

<p>In that case, <code>$root-&gt;guts()</code> would return three items: an element object for the first <code>&lt;hr&gt;</code>, a text string &quot;Hooboy!&quot;, and another <code>&lt;hr&gt;</code> element object.</p>

<p>For cases where you want definitely one element (so you can treat it as a &quot;document fragment&quot;, roughly speaking), call <code>guts()</code> in scalar context, as in <code>$parent_for_nodes = $root-&gt;guts()</code>. That works like <code>guts()</code> in list context; in fact, <code>guts()</code> in list context would have returned exactly one value, and if it would have been an object (as opposed to a text string), then that&#39;s what <code>guts</code> in scalar context will return. Otherwise, if <code>guts()</code> in list context would have returned no values at all, then <code>guts()</code> in scalar context returns undef. In all other cases, <code>guts()</code> in scalar context returns an implicit <code>&lt;div&gt;</code> element node, with children consisting of whatever nodes <code>guts()</code> in list context would have returned. Note that that may detach those nodes from <code>$root</code>&#39;s tree.</p>

<h2 id="disembowel">disembowel</h2>

<pre><code>  @nodes = $root-&gt;disembowel();
  $parent_for_nodes = $root-&gt;disembowel();</code></pre>

<p>The <code>disembowel()</code> method works just like the <code>guts()</code> method, except that disembowel definitively destroys the tree above the nodes that are returned. Usually when you want the guts from a tree, you&#39;re just going to toss out the rest of the tree anyway, so this saves you the bother. (Remember, &quot;disembowel&quot; means &quot;remove the guts from&quot;.)</p>

<h1 id="INTERNAL-METHODS"><a id="INTERNAL"></a>INTERNAL METHODS</h1>

<p>You should not need to call any of the following methods directly.</p>

<h2 id="element_class">element_class</h2>

<pre><code>  $classname = $h-&gt;element_class;</code></pre>

<p>This method returns the class which will be used for new elements. It defaults to HTML::Element, but can be overridden by subclassing or esoteric means best left to those will will read the source and then not complain when those esoteric means change. (Just subclass.)</p>

<h2 id="comment">comment</h2>

<p>Accept a &quot;here&#39;s a comment&quot; signal from HTML::Parser.</p>

<h2 id="declaration">declaration</h2>

<p>Accept a &quot;here&#39;s a markup declaration&quot; signal from HTML::Parser.</p>

<h2 id="done">done</h2>

<p>TODO: document</p>

<h2 id="end">end</h2>

<p>Either: Acccept an end-tag signal from HTML::Parser Or: Method for closing currently open elements in some fairly complex way, as used by other methods in this class.</p>

<p>TODO: Why is this hidden?</p>

<h2 id="process">process</h2>

<p>Accept a &quot;here&#39;s a PI&quot; signal from HTML::Parser.</p>

<h2 id="start">start</h2>

<p>Accept a signal from HTML::Parser for start-tags.</p>

<p>TODO: Why is this hidden?</p>

<h2 id="stunt">stunt</h2>

<p>TODO: document</p>

<h2 id="stunted">stunted</h2>

<p>TODO: document</p>

<h2 id="text">text</h2>

<p>Accept a &quot;here&#39;s a text token&quot; signal from HTML::Parser.</p>

<p>TODO: Why is this hidden?</p>

<h2 id="tighten_up">tighten_up</h2>

<p>Legacy</p>

<p>Redirects to <a href="https://metacpan.org/pod/HTML::Element#delete_ignorable_whitespace">&quot;delete_ignorable_whitespace&quot; in HTML::Element</a>.</p>

<h2 id="warning">warning</h2>

<p>Wrapper for CORE::warn</p>

<p>TODO: why not just use carp?</p>

<h1 id="SUBROUTINES">SUBROUTINES</h1>

<h2 id="DEBUG">DEBUG</h2>

<p>Are we in Debug mode? This is a constant subroutine, to allow compile-time optimizations. To control debug mode, set <code>$HTML::TreeBuilder::DEBUG</code> <i>before</i> loading HTML::TreeBuilder.</p>

<h1 id="HTML-AND-ITS-DISCONTENTS"><a id="HTML"></a>HTML AND ITS DISCONTENTS</h1>

<p>HTML is rather harder to parse than people who write it generally suspect.</p>

<p>Here&#39;s the problem: HTML is a kind of SGML that permits &quot;minimization&quot; and &quot;implication&quot;. In short, this means that you don&#39;t have to close every tag you open (because the opening of a subsequent tag may implicitly close it), and if you use a tag that can&#39;t occur in the context you seem to using it in, under certain conditions the parser will be able to realize you mean to leave the current context and enter the new one, that being the only one that your code could correctly be interpreted in.</p>

<p>Now, this would all work flawlessly and unproblematically if: 1) all the rules that both prescribe and describe HTML were (and had been) clearly set out, and 2) everyone was aware of these rules and wrote their code in compliance to them.</p>

<p>However, it didn&#39;t happen that way, and so most HTML pages are difficult if not impossible to correctly parse with nearly any set of straightforward SGML rules. That&#39;s why the internals of HTML::TreeBuilder consist of lots and lots of special cases -- instead of being just a generic SGML parser with HTML DTD rules plugged in.</p>

<h1 id="TRANSLATIONS?"><a id="TRANSLATIONS"></a>TRANSLATIONS?</h1>

<p>The techniques that HTML::TreeBuilder uses to perform what I consider very robust parses on everyday code are not things that can work only in Perl. To date, the algorithms at the center of HTML::TreeBuilder have been implemented only in Perl, as far as I know; and I don&#39;t foresee getting around to implementing them in any other language any time soon.</p>

<p>If, however, anyone is looking for a semester project for an applied programming class (or if they merely enjoy <i>extra-curricular</i> masochism), they might do well to see about choosing as a topic the implementation/adaptation of these routines to any other interesting programming language that you feel currently suffers from a lack of robust HTML-parsing. I welcome correspondence on this subject, and point out that one can learn a great deal about languages by trying to translate between them, and then comparing the result.</p>

<p>The HTML::TreeBuilder source may seem long and complex, but it is rather well commented, and symbol names are generally self-explanatory. (You are encouraged to read the Mozilla HTML parser source for comparison.) Some of the complexity comes from little-used features, and some of it comes from having the HTML tokenizer (HTML::Parser) being a separate module, requiring somewhat of a different interface than you&#39;d find in a combined tokenizer and tree-builder. But most of the length of the source comes from the fact that it&#39;s essentially a long list of special cases, with lots and lots of sanity-checking, and sanity-recovery -- because, as Roseanne Rosannadanna once said, &quot;it&#39;s always <i>something</i>&quot;.</p>

<p>Users looking to compare several HTML parsers should look at the source for Raggett&#39;s Tidy (<code>&lt;http://www.w3.org/People/Raggett/tidy/&gt;</code>), Mozilla (<code>&lt;http://www.mozilla.org/&gt;</code>), and possibly root around the browsers section of Yahoo to find the various open-source ones (<code>&lt;http://dir.yahoo.com/Computers_and_Internet/Software/Internet/World_Wide_Web/Browsers/&gt;</code>).</p>

<h1 id="BUGS">BUGS</h1>

<p>* Framesets seem to work correctly now. Email me if you get a strange parse from a document with framesets.</p>

<p>* Really bad HTML code will, often as not, make for a somewhat objectionable parse tree. Regrettable, but unavoidably true.</p>

<p>* If you&#39;re running with <code>implicit_tags</code> off (God help you!), consider that <code>$tree-&gt;content_list</code> probably contains the tree or grove from the parse, and not <code>$tree</code> itself (which will, oddly enough, be an implicit <code>&lt;html&gt;</code> element). This seems counter-intuitive and problematic; but seeing as how almost no HTML ever parses correctly with <code>implicit_tags</code> off, this interface oddity seems the least of your problems.</p>

<h1 id="BUG-REPORTS"><a id="BUG"></a>BUG REPORTS</h1>

<p>When a document parses in a way different from how you think it should, I ask that you report this to me as a bug. The first thing you should do is copy the document, trim out as much of it as you can while still producing the bug in question, and <i>then</i> email me that mini-document <i>and</i> the code you&#39;re using to parse it, to the HTML::Tree bug queue at <span style="white-space: nowrap;"><code>&lt;bug-html-tree at rt.cpan.org&gt;</code></span>.</p>

<p>Include a note as to how it parses (presumably including its <code>$tree-&gt;dump</code> output), and then a <i>careful and clear</i> explanation of where you think the parser is going astray, and how you would prefer that it work instead.</p>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p>For more information about the HTML-Tree distribution: <a href="https://metacpan.org/pod/HTML::Tree">HTML::Tree</a>.</p>

<p>Modules used by HTML::TreeBuilder: <a href="./HTML::Parser.html">HTML::Parser</a>, <a href="https://metacpan.org/pod/HTML::Element">HTML::Element</a>, <a href="https://metacpan.org/pod/HTML::Tagset">HTML::Tagset</a>.</p>

<p>For converting between <a href="https://metacpan.org/pod/XML::DOM::Node">XML::DOM::Node</a>, <a href="https://metacpan.org/pod/HTML::Element">HTML::Element</a>, and <a href="https://metacpan.org/pod/XML::Element">XML::Element</a> trees: <a href="https://metacpan.org/pod/HTML::DOMbo">HTML::DOMbo</a>.</p>

<p>For opening a HTML file with automatic charset detection: <a href="https://metacpan.org/pod/IO::HTML">IO::HTML</a>.</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Current maintainers:</p>

<ul>

<li><p>Christopher J. Madsen <span style="white-space: nowrap;"><code>&lt;perl AT cjmweb.net&gt;</code></span></p>

</li>
<li><p>Jeff Fearn <span style="white-space: nowrap;"><code>&lt;jfearn AT cpan.org&gt;</code></span></p>

</li>
</ul>

<p>Original HTML-Tree author:</p>

<ul>

<li><p>Gisle Aas</p>

</li>
</ul>

<p>Former maintainers:</p>

<ul>

<li><p>Sean M. Burke</p>

</li>
<li><p>Andy Lester</p>

</li>
<li><p>Pete Krawczyk <span style="white-space: nowrap;"><code>&lt;petek AT cpan.org&gt;</code></span></p>

</li>
</ul>

<p>You can follow or contribute to HTML-Tree&#39;s development at <a href="https://github.com/kentfredric/HTML-Tree">https://github.com/kentfredric/HTML-Tree</a>.</p>

<h1 id="COPYRIGHT-AND-LICENSE"><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1>

<p>Copyright 1995-1998 Gisle Aas, 1999-2004 Sean M. Burke, 2005 Andy Lester, 2006 Pete Krawczyk, 2010 Jeff Fearn, 2012 Christopher J. Madsen.</p>

<p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<p>The programs in this library are distributed in the hope that they will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install HTML::Tree, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm HTML::Tree</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install HTML::Tree</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./HTML::TreeBuilder.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
